import { createApp } from 'vue'
import App from './App.vue'
import CardVue from './components/Card.vue'
import mitt from "mitt"
import Loading from "@/components/loading/index.ts";
import { MyUse } from './MyUse'
import loading from '@/components/loading/index.ts'
//import ElementPlus from 'element-plus'
//import 'element-plus/dist/index.css'

const Mitt = mitt()

export const app = createApp(App)

//定义全局变量,就可以在任何组件中使用$env
app.config.globalProperties.$env = 'dev'
//定义全局过滤器 $filter.format('')
app.config.globalProperties.$filter={
  format<T> (str:T){
    return '熏悟空'+str;
  }
}
//消除自定义全局变量使用报红线
type Filter = {
  format<T>(str:T):string
}

declare module 'vue'{
  export interface ComponentCustomProperties{
    $Bus: typeof Mitt,
    $filter: Filter,
    $env: string
    $vLoading: {show():void,hide():void}
  }
}


app.config.globalProperties.$Bus = Mitt

app.component('Card',CardVue)
//注册Loading组件
MyUse(Loading)
//app.use(ElementPlus)
app.mount('#app')

